/*
 * validator.c
 *
 *  Created on: 14/10/2011
 *      Author: utn_so
 */

#include "../../headers/GlobalHeader.h"


int validoMedianteRegex(char* textoParaValidar, char * pattern){
           regex_t    preg;
           //char       *pattern = "^ale";
           int        rc;
           size_t     nmatch = 2;
           regmatch_t pmatch[2];

           if (0 != (rc = regcomp(&preg, pattern, REG_EXTENDED))) {
              printf("regcomp() failed, returning nonzero (%d)\n", rc);
              exit(EXIT_FAILURE);
           }

           rc = regexec(&preg, textoParaValidar, nmatch, pmatch, 0);

           regfree(&preg);

           return rc;
}
